//package com.kungfuhacking.wristbandpro.my.presenter;
//
//import android.content.Context;
//import android.support.v7.widget.RecyclerView;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.RelativeLayout;
//import android.widget.TextView;
//
//import com.kungfuhacking.wristbandpro.R;
//import com.kungfuhacking.wristbandpro.my.activity.FamilyDetailsActivity;
//import com.kungfuhacking.wristbandpro.my.bean.FamilyData;
//
///**
// * Created by Aaron on 17/6/2.
// */
//
//public class FamilyNumAdapter extends RecyclerView.Adapter<FamilyNumAdapter.MyViewHolder> implements View.OnClickListener {
//
//    private static final int NORMAL_VIEW = 1;
//    private static final int BOTTOM_VIEW = 2;
//    private String TAG = getClass().getSimpleName();
//
//    private Context context;
//    private FamilyData familyData;
//
//    public FamilyNumAdapter(Context context, FamilyData familyData) {
//        this.context = context;
//        this.familyData = familyData;
//
//    }
//
//    public void setFamilyData(FamilyData familyData) {
//        this.familyData = familyData;
//    }
//
//    @Override
//    public FamilyNumAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//
//        switch (viewType) {
//
//            case NORMAL_VIEW:
//                return new FamilyNumAdapter.MyViewHolder(
//                        LayoutInflater.from(context).inflate(R.layout.item_family_nums, parent,
//                                false), viewType);
//            case BOTTOM_VIEW:
//                return new FamilyNumAdapter.MyViewHolder(
//                        LayoutInflater.from(context).inflate(R.layout.bottom_family_detail, parent,
//                                false), viewType);
//        }
//        return null;
//    }
//
//    @Override
//    public int getItemViewType(int position) {
//
//        if (familyData == null || familyData.getFamily() == null)
//            return -1;
//
//        if (position == familyData.getFamily().size())
//            return BOTTOM_VIEW;
//
//        return NORMAL_VIEW;
//    }
//
//    @Override
//    public void onBindViewHolder(FamilyNumAdapter.MyViewHolder holder, int position) {
//
//        if (familyData == null)
//            return;
//
//        switch (getItemViewType(position)) {
//
//            case NORMAL_VIEW:
//                holder.tvName.setText(familyData.getFamily().get(position).getName());
//                holder.tvWorkspace.setText(familyData.getFamily().get(position).getWorkUnit());
//                holder.tvContact.setText(familyData.getFamily().get(position).getPhoneNum());
//                break;
//
//            case BOTTOM_VIEW:
//                holder.rlAccountAdress.setOnClickListener(this);
//                holder.rlAccountType.setOnClickListener(this);
//                holder.rlAdress.setOnClickListener(this);
//                holder.rlHomeCondition.setOnClickListener(this);
//
//                holder.tvHomeCondition.setText(familyData.getHouseType());
//                holder.tvFamilyAdress.setText(familyData.getAddress());
//                holder.tvAccountType.setText(familyData.getHukouType());
//                holder.tvAccountAdress.setText(familyData.getHukouAddress());
//                break;
//
//        }
//
//    }
//
//    @Override
//    public int getItemCount() {
//
//        if (familyData == null || familyData.getFamily() == null)
//            return 0;
//
//        return familyData.getFamily().size() + 1;
//    }
//
//    @Override
//    public void onClick(View v) {
//
//        switch (v.getId()) {
//
//            case R.id.rlAccountAdress://户口地址
//                ((FamilyDetailsActivity) context).changeIDAddress();
//                break;
//
//            case R.id.rlAccountType://户口类型
//                ((FamilyDetailsActivity) context).changeIDStyle();
//                break;
//
//            case R.id.rlAdress://地址
//                ((FamilyDetailsActivity) context).changeAddress();
//                break;
//
//            case R.id.rlHomeCondition://房产情况
//                ((FamilyDetailsActivity) context).changeHouseConduction();
//                break;
//
//        }
//    }
//
//    class MyViewHolder extends RecyclerView.ViewHolder {
//
//        TextView tvName;
//        TextView tvWorkspace;
//        TextView tvContact;
//        RelativeLayout rlHomeCondition;
//        RelativeLayout rlAdress;
//        RelativeLayout rlAccountType;
//        RelativeLayout rlAccountAdress;
//
//        TextView tvHomeCondition;
//        TextView tvFamilyAdress;
//        TextView tvAccountType;
//        TextView tvAccountAdress;
//
//        MyViewHolder(View view, int viewType) {
//            super(view);
//
//            switch (viewType) {
//
//                case NORMAL_VIEW:
//                    tvName = (TextView) view.findViewById(R.id.tvName);
//                    tvWorkspace = (TextView) view.findViewById(R.id.tvWorkspace);
//                    tvContact = (TextView) view.findViewById(R.id.tvContact);
//                    break;
//
//                case BOTTOM_VIEW:
//                    rlHomeCondition = (RelativeLayout) view.findViewById(R.id.rlHomeCondition);
//                    rlAdress = (RelativeLayout) view.findViewById(R.id.rlAdress);
//                    rlAccountType = (RelativeLayout) view.findViewById(R.id.rlAccountType);
//                    rlAccountAdress = (RelativeLayout) view.findViewById(R.id.rlAccountAdress);
//
//                    tvHomeCondition = (TextView) view.findViewById(R.id.tvHomeCondition);
//                    tvFamilyAdress = (TextView) view.findViewById(R.id.tvFamilyAdress);
//                    tvAccountType = (TextView) view.findViewById(R.id.tvAccountType);
//                    tvAccountAdress = (TextView) view.findViewById(R.id.tvAccountAdress);
//                    break;
//
//            }
//
//        }
//    }
//}
